/*
 * global.h
 *
 *  Created on: Dec 7, 2014
 *      Author: root
 */
/******************************************************************************************************************/
#ifndef GLOBAL_H_
#define GLOBAL_H_
/******************************************************************************************************************/
#include <time.h>
#include "typedef.h"
#include "./socket.h"
#include "../tcp/tcp.h"
#include "../udp/udp.h"
/******************************************************************************************************************/
extern TCP_VEC g_tcp_v;
extern UDP_VEC g_udp_v;
extern TCP_MAP g_tcp_m;
extern UDP_MAP g_udp_m;
extern int g_ip_count;
extern char g_label[64];
extern bool g_flag;
/******************************************************************************************************************/
double ConvertTimevalToDouble(struct timeval time);
bool GlobalInit();
void GlobalEnd();
void SleepCertainTime();
TcpStat* FindTcpStream(Socket client, Socket server);
UdpStat* FindUdpStream(Socket client, Socket server);
bool FreeTcpStream(Socket client, Socket server);
int IsClientToServer(Socket src, Socket dest);
int GetTcpClientState(Socket client, Socket server);
int GetTcpServerState(Socket client, Socket server);
void AddToTcpVector(TcpStat* stat);
void AddToUdpVector(UdpStat* stat);
/******************************************************************************************************************/

#endif /* GLOBAL_H_ */
